package com.btb.adapter.constant;

import java.util.Arrays;
import java.util.Objects;

public enum QueryType {
	HERO("1"), FISH("2");
	private String type;
	private QueryType(String type) {
		this.type = type;
	}

	public String getType() {
		return type;
	}
	public static boolean checkType(Integer type) {
		return Arrays.stream(values()).anyMatch(x -> Objects.equals(Integer.parseInt(x.getType()), type));
	}
	public static QueryType type(Integer type) {
		return Arrays.stream(values()).filter(x -> Objects.equals(Integer.parseInt(x.getType()), type)).findAny().orElse(null);
	}
	public static boolean check(String type) {
		return Arrays.stream(values()).anyMatch(x -> Objects.equals(x.name().toLowerCase(), type));
	}
	public static QueryType type(String type) {
		return Arrays.stream(values()).filter(x->Objects.equals(x.name().toLowerCase(), type)).findAny().orElse(null);
	}
}
